package edu.bw.service.impl;

import edu.bw.dao.AccountDao;
import edu.bw.po.Account;
import edu.bw.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
//@Transactional(propagation = Propagation.REQUIRED)
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AccountDao accountDao;

    @Override
    @Transactional(propagation = Propagation.REQUIRED)
    public void transferAccounts(Account transferInAccount, Account transferOutAccount) {
        accountDao.updateAccount(transferInAccount);
        int i = 1 / 0;
        accountDao.updateAccount(transferOutAccount);
    }
}
